﻿using System.Security.Claims;
using Microsoft.AspNetCore.Components.Authorization;

namespace BlazorApp.Client.Pages;
public class MyAuthenticationStateProvider : AuthenticationStateProvider
{
    //public static bool IsAuthenticate { get; set; }
    public override Task<AuthenticationState> GetAuthenticationStateAsync()
    {
        //如何获得身份信息
               

        var identity = new ClaimsIdentity("custom", ClaimTypes.Name, ClaimTypes.Role);

        identity.AddClaim(new(ClaimTypes.Name, "admin"));

        return Task.FromResult(new AuthenticationState(new(identity)));
    }
}
